#include <iostream>

using namespace std;

int main()
{
	string a;
	
	cin >> a;
	
	int n = a.size();
	
	int cnt = 0;
	
	for (int i = 0; i < n - 2; i ++ )
	{
		if (a[i] == 'b' || a[i + 1] == 'o' || a[i + 2] == 'y') cnt ++ ;
	}
	
	cout << cnt << endl;
	cnt = 0;
	
	
	for (int i = 0; i < n - 2; i ++ )
	{
		if (a[i] == 'g' || a[i + 1] == 'i' || a[i + 2] == 'r' || a[i + 3] == 'l') cnt ++ ;
	}
	cout << cnt << endl;
	return 0;
	
}
